xen: sched_credit: when picking, make sure we get an idle one, if any
authorDario Faggioli <dario.faggioli@citrix.com>
Wed, 17 Apr 2013 10:57:30 +0000 (10:57 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 17 Apr 2013 11:11:14 +0000 (12:11 +0100)
commitebb064aa22715ae473f72468d093e7a05e3c3c58
tree7d4cd7cf72400e3f3e3e53711ad120158f2a2cd6
parent225fa55e53efa8b8e3d964d8572c89001d547d4e
xen: sched_credit: when picking, make sure we get an idle one, if any

The pcpu picking algorithm treats two threads of a SMT core the same.
More specifically, if one is idle and the other one is busy, they both
will be assigned a weight of 1. Therefore, when picking begins, if the
first target pcpu is the busy thread (and if there are no other idle
pcpu than its sibling), that will never change.

This change fixes this by ensuring that, before entering the core of
the picking algorithm, the target pcpu is an idle one (if there is an
idle pcpu at all, of course).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/sched_credit.c